package com.mars.deepseek.controller;

import com.mars.deepseek.model.common.R;
import com.mars.deepseek.model.dto.ChatRequest;
import com.mars.deepseek.model.dto.ChatResponse;
import com.mars.deepseek.service.DeepSeekService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * DeepSeek API控制器
 */
@Slf4j
@RestController
@RequestMapping("/api/deepseek")
@RequiredArgsConstructor
@Tag(name = "DeepSeek API", description = "DeepSeek人工智能模型接口")
public class DeepSeekController {

    private final DeepSeekService deepSeekService;

    /**
     * 聊天接口
     *
     * @param request 聊天请求
     * @return 聊天响应
     */
    @PostMapping("/chat")
    @Operation(summary = "聊天接口", description = "向DeepSeek模型发送聊天请求并获取回复")
    public R<ChatResponse> chat(
            @Parameter(description = "聊天请求参数", required = true)
            @RequestBody ChatRequest request) {
        log.info("接收到聊天请求: {}", request);
        ChatResponse response = deepSeekService.chat(request);
        return R.success(response);
    }
} 